%将初始状态设为：自旋向下(-1)占总数的比例为p
function mat = isingmat_ini(n, p)
    mat = ones(n);
    r = rand(n);
    i = find(r < p);
    mat(i) = -1;
    return
end